function y = vardim(x)
% VARDIM function
% x0=[1-1/n,1-2/n,...,1-n/n];
n=length(x); y=0;
tp1=0;tp2=0; 
for i=1:n
    tp1=tp1+(x(i)-1)^2;
    tp2=tp2+i*x(i);%-n*(n+1)/2;
end
y=y+tp1+(tp2-n*(n+1)/2)^2+(tp2-n*(n+1)/2)^4;

